package net.hn.hnms.biz.plan.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.hn.hnms.biz.plan.domain.YieldPeelTemporary;
import net.hn.hnms.biz.plan.request.FootageYieldReq;
import net.hn.hnms.biz.plan.request.YieldPeelTemporaryReq;
import net.hn.hnms.biz.plan.service.YieldPeelTemporaryService;
import net.hn.hnms.biz.plan.vo.FootageYieldCountVo;
import net.hn.hnms.biz.plan.vo.YieldPeelTemporaryLineChartVo;
import net.hn.hnms.biz.plan.vo.YieldPeelTemporaryVo;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "华能集团综合概览临时接口", tags = {"华能集团综合概览临时接口"})
@RestController
@RequestMapping("/yield/peel")
@EnableScheduling
@Slf4j
public class YieldPeelController {

    @Autowired
    private YieldPeelTemporaryService yieldPeelTemporaryService;

    @GetMapping("/getYield")
    public List<YieldPeelTemporary> getYield(YieldPeelTemporaryReq req) {
        List<YieldPeelTemporary> list = yieldPeelTemporaryService.selectList(req);
        return list;
    }


    @ApiOperation("获取当日当月当月产量和剥离量")
    @GetMapping("/getYieldOrPeelSum")
    public R<YieldPeelTemporaryVo> getYieldOrPeelSum(YieldPeelTemporaryReq req) {
        return R.ok(yieldPeelTemporaryService.yieldCount(req));
    }

    @ApiOperation("产量和剥离量折线图")
    @GetMapping("/yieldOrPeelLineChart")
    @AutoSetMineCode
    public R<List<YieldPeelTemporaryLineChartVo>> yieldOrPeelLineChart(YieldPeelTemporaryReq req) {
        return R.ok(yieldPeelTemporaryService.yieldOrPeelLineChart(req));
    }


    @ApiOperation("昨日产量进尺统计")
    @GetMapping("/yestDayCount")
    public R<FootageYieldCountVo> yestDayCount(FootageYieldReq req) {
        return R.ok(yieldPeelTemporaryService.yestDayCount(req));
    }
}
